<template>
    <div>

        <el-form :inline="true" class="demo-form-inline">
            <el-form-item>
                <el-button size="mini" type="primary" @click="dialogUser=true">上传
                </el-button>
            </el-form-item>
        </el-form>
        <el-table
                :data="tableData"
                ref="multipleTable"
                style="width: 100%">
            <el-table-column
                    prop="name"
                    label="产品名"
                    width="180">
                <template slot-scope="scope">
                    <template v-if="flag[scope.row.name]">
                        <el-input v-model="scope.row.name" size="mini"></el-input>
                    </template>
                    <template v-else>
                        <span @click="edit(scope.row.name)">{{scope.row.name}}</span>
                    </template>
                </template>
            </el-table-column>
            <el-table-column
                    prop="text"
                    label="评价"
                    width="180">
            </el-table-column>
            <el-table-column
                    prop="img"
                    width="180"
                    label="图片">
            </el-table-column>
            <el-table-column
                    prop="text"
                    label="追加评价"
                    width="180">
            </el-table-column>
            <el-table-column
                    prop="img"
                    width="180"
                    label="追加图片">
            </el-table-column>
            <el-table-column
                    prop="text"
                    label="添加人"
                    width="180">
            </el-table-column>
            <el-table-column
                    prop="text"
                    label="产品链接"
                    width="180">
            </el-table-column>
            <el-table-column
                    prop="text"
                    label="找评价链接借鉴"
                    width="180">
            </el-table-column>
        </el-table>
        <el-dialog title="" :visible.sync="dialogUser" custom-class="backupdedleteUserDialog">
            <el-form label-width="110px">
                <el-form-item label="评价">
                    <el-input auto-complete="off" type="textarea" v-model='list.text1' autosize></el-input>
                </el-form-item>
                <el-form-item label="图片">
                    <el-upload
                            ref="upload1"
                            class="upload-demo"
                            action="http://39.104.83.69:2727/v1/api/other/UploadImg"
                            multiple
                            name="1"
                            :data="list"
                            :auto-upload="false"
                            :limit="6"
                            :on-success="uploadSuccess"
                    >
                        <el-button size="small" type="primary">点击上传</el-button>
                    </el-upload>
                </el-form-item>
                <el-form-item label="追加评论">
                    <el-input auto-complete="off" type="textarea" v-model='list.text2' autosize></el-input>
                </el-form-item>


                <el-form-item label="追加图片">
                    <el-upload
                            ref="upload2"
                            class="upload-demo"
                            action="http://39.104.83.69:2727/v1/api/other/UploadImg"
                            name="2"
                            multiple
                            :data="list"
                            :auto-upload="false"
                            :limit="6"
                            :on-success="uploadSuccess"
                    >
                        <el-button size="small" type="primary">点击上传</el-button>

                    </el-upload>
                </el-form-item>
                <el-form-item style="text-align: center;">
                    <el-button type="primary" style="width: 200px;" @click="submitUpload">上传</el-button>
                </el-form-item>
            </el-form>
        </el-dialog>
    </div>
</template>
<script>
    export default {
        name: 'AdminBackup',
        data() {
            return {
                tableData: [
                    {name: '测试', text: '测试评价'}
                ],
                dialogUser: false,
                list: {
                    text1: '',
                    text2: '',
                },
                fileList: [],
                flag: {},
                test: false,
                testt: 123
            }
        },
        methods: {
            submitUpload() {
                this.$refs.upload1.submit();
                this.$refs.upload2.submit();
            },
            uploadSuccess() {

            },
            edit(a) {
                this.flag[a] = true;
                /* this.$refs.multipleTable.doLayout();
                 console.log(this.$refs.multipleTable)*/
            },

        },
        mounted() {

        },
    }
</script>
<style>
    .backupdedleteUserDialog {
        width: 700px;
    }
</style>
